package com.xoa.controller.enterpriseTax;


import com.xoa.model.enterpriseTax.constructingUnit.ConstructingUnit;
import com.xoa.service.enterpriseTax.ConstruingUnitService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/construingunit")
public class ConstruingUnitController {

    @Autowired
    protected ConstruingUnitService construingUnitService;

    @RequestMapping("/selectConstruingUnit")
    public String selectConstruingUnit(){
        return "/app/enterpriseTax/construingunit";
    }
    @RequestMapping("/selectH5construingunit")
    public String selectH5construingunit(){
        return "/app/enterpriseTax/H5construingunit";
    }

    @RequestMapping("/selectAllConstruingUnit")
    @ResponseBody
    public ToJson<ConstructingUnit> selectAllConstruingUnit(boolean useFlag,
                                                            Integer page,
                                                            Integer limit,
                                                            ConstructingUnit record){
        return construingUnitService.selectAllConstruingUnit(useFlag,page,limit,record);
    }


    @RequestMapping("/insertAllConstruingUnit")
    @ResponseBody
    public ToJson<ConstructingUnit> insertAllConstruingUnit(ConstructingUnit record){
        return construingUnitService.insertAllConstruingUnit(record);
    }


    @RequestMapping("/updateAllConstruingUnit")
    @ResponseBody
    public ToJson<ConstructingUnit> updateAllConstruingUnit(ConstructingUnit record){
        return construingUnitService.updateAllConstruingUnit(record);
    }

    @RequestMapping("/deleteAllConstruingUnit")
    @ResponseBody
    public ToJson<ConstructingUnit> deleteAllConstruingUnit(Integer cuId){
        return construingUnitService.deleteAllConstruingUnit(cuId);
    }


    @ResponseBody
    @RequestMapping("/uploadConstructingUnit")
    public ToJson<ConstructingUnit> uploadConstructingUnit(MultipartFile file,
                                                           HttpServletRequest request,
                                                           HttpServletResponse response,
                                                           HttpSession session){
        return construingUnitService.uploadConstructingUnit(file, request, response, session);
    }

    @RequestMapping("/selectAllConstruingUnit2")
    @ResponseBody
    public ToJson<ConstructingUnit> selectAllConstruingUnit2(){
        return construingUnitService.selectAllConstruingUnit2();
    }


}




